/**
 * 
 * @author Marina Polese
 *
 */

package capture;

public enum Port {
	TUTTE(""),
	HTTP_80("port 80"),
	DNS_53("port 53"), 
	SMTP_25("port 25"), 
	FTP_21("port 21"), 
	TELNET_23("port 23"), 
	POP3_110("port 110"), 
	SNMP_161_162("port 161 or port 162"), 
	IMAP_143("port 143"), 
	NNTP_119("port 119"), 
	LDAP_389("port 389"), 
	NCP_524("port 524"), 
	NetbiosSMB_137_138_139("port 137 or port 138 or port 139");
	
	private final String port;
	
	private Port(String port){
		this.port = port;
	}
	
	public String getPort(){
		return port;
	}
	
	public static Port convertToEnum(String port){
		if(port.equals("HTTP: 80"))
			return Port.HTTP_80;
		else if(port.equals("DNS: 53"))
			return Port.DNS_53;
		else if(port.equals("SMTP: 25"))
			return Port.SMTP_25;
		else if(port.equals("FTP: 21"))
			return Port.FTP_21;
		else if(port.equals("TELNET: 23"))
			return Port.TELNET_23;
		else if(port.equals("POP3: 110"))
			return Port.POP3_110;
		else if(port.equals("SNMP: 161 o 162"))
			return Port.SNMP_161_162;
		else if(port.equals("IMAP: 143"))
			return Port.IMAP_143;
		else if(port.equals("NNTP: 119"))
			return Port.NNTP_119;
		else if(port.equals("LDAP: 389"))
			return Port.LDAP_389;
		else if(port.equals("NCP: 524"))
			return Port.NCP_524;
		else if(port.equals("Netbios SMB: 137 o 138 o 139"))
			return Port.NetbiosSMB_137_138_139;
		else
			return Port.TUTTE;
	}
}
